//不要给我WA WA 叫
//一定AC
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <iomanip>
#include <climits>
#define int long long 
#define x first 
#define y second 
using namespace std;
const int N = 1e5 + 10;
int a[N];
int sum(int x)
{
    return (x + 1) * x / 2;
}
void solve()
{
    int n;
    cin >> n;
    int p = 0;
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        if(sum(i) >= n) 
        {
            p = i;
            break;
        }
    }
    int day = sum(p) - n;
    
    for(int i = 1; i <= p; i++)  ans += (i * i);
    
    ans = (ans - day * p);

    cout << ans << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int t = 1;
    while(t -- )  solve();
    return 0;
}
